home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / asm_subr.arc / SCHAR < prev    next >
Encoding:
Text File  |  1986-01-20  |  3.3 KB  |  108 lines

  1. ;-------------------------schar routine begins--------------------------+
  2. ; NAME  SCHAR
  3. ;
  4. ; ROUTINE TO PLOT A STROKE CHARACTER 
  5. ;
  6. ; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
  7. ;         page : 148
  8. ;
  9. ; FUNCTION: This routine plots a stroke character.  It uses a stroke
  10. ; character table in which each character is stored as a series of
  11. ; strokes.  The user must create the stroke character table according
  12. ; to specific rules.  Each stroke is stored as three bytes.  The first
  13. ; byte contains a code as follows:
  14. ;
  15. ;    1Ah    =    end of strokes
  16. ;    'U'    =    pen Up; move to new posn but don't draw
  17. ;    'D'    =    pen Down; draw a stroke from old to new posn
  18. ;
  19. ; The second byte contains the local x-coordinate of the new current
  20. ; position, and the third byte contains the local y-coordinate of the
  21. ; new current position.  These local coordinates are relative to the
  22. ; upper left corner of the character cell.  At the beginning of the
  23. ; stroke table is a table of addresses for the locations of the strokes
  24. ; for each of the characters.
  25. ;
  26. ; INPUT:  Upon entry:
  27. ;
  28. ;    ACSII code character is in AL
  29. ;    x-coordinate of upper left corner of character cell is in x0
  30. ;    y-coordinate of upper left corner of character cell is in y0
  31. ;    horizontal magnitude is in xmagn
  32. ;    vertical magnitude is in ymagn
  33. ;    color of character is in color
  34. ;
  35. ; OUTPUT:  Just to the screen.
  36. ;
  37. ; REGISTERS USED: No registers are modified.
  38. ;
  39. ; SEGMENTS REFERENCED:  Upon entry ES must point to the video RAM at
  40. ; B8000h and DS must point to the data segment used by the point and
  41. ; line drawing routines.  This data segment must also contain the table
  42. ; of stroke characters.
  43. ;
  44. ; ROUTINES CALLED:  SETLINE
  45. ;
  46. ; SPECIAL NOTES: No bounds checking is performed.  Unpredictable results
  47. ; will be displayed if the horizontal or vertical magnitude is too large.
  48. ; A string of raster characters can be displayed using the GMESSOUT
  49. ; routine available on this disk.
  50. ;
  51. ; ROUTINE TO PLOT A STROKE CHARACTER
  52. ;
  53. schar    proc    far
  54. ;
  55.     push    si        ; save registers
  56.     push    cx
  57.     push    ax
  58. ;
  59.     cbw            ; make the ASCII code into 16-bit
  60.     sal    ax,1        ; times 2
  61.     mov    si,ax        ; into the index
  62.     mov    si,ptable[si]    ; look up the particular character
  63.     mov    ax,x0        ; x-coord of upper left char
  64.     mov    x2,ax
  65.     mov    ax,y0        ; y-coord of upper left corner
  66.     mov    y2,ax
  67. ;
  68. ; run through the strokes
  69. newstroke:
  70.     lodsb            ; get the code byte
  71.     cmp    al,1Ah        ; end of strokes ?
  72.     jz    scharexit
  73.     mov    dl,al        ; save code
  74. ;
  75. ; update x-coord of current position
  76.     mov    ax,x2        ; old x-coord
  77.     mov    x1,ax        ; gets pushed back
  78.     lodsb            ; new x-coord
  79.     mov    cl,xmagn    ; times xmagn
  80.     mul    cl        l multiply
  81.     add    ax,x0        ; add to upper left corner
  82.     mov    x2,ax        ; and put into current position
  83. ;
  84. ; update y-coordinate of current position
  85.     mov    ax,y2        ; old y-coord
  86.     mov    y1,ax        ; gets pushed back
  87.     lodsb            ; new y-coord
  88.     mov    cl,ymagn    ; times ymagn
  89.     mul    cl        l multiply
  90.     add    ax,y0        ; add to upper left corner
  91.     mov    y2,ax        ; and put into current position
  92. ;
  93.     cmp    dl,'U'        ; pen up ?
  94.     je    newstroke    ; skip if so
  95. ;
  96.     call    setline        ; draw the stroke
  97. ;
  98.     jmp    newstroke    ; next stroke
  99. ;
  100. scharexit:
  101.     pop    ax        ; restore registers
  102.     pop    cx
  103.     pop    si
  104. ;
  105.     ret            ; return
  106. schar    endp
  107. ;-------------------------schar routine ends---------------------------+
  108.